<!-- 口岸现场查验-智能查验-仪器设备数据采集 -->
<template>
  <div>
    <!--引用表格-->
    <BasicTable @register="registerTable" :showIndexColumn="true">
      <!-- 点击（非）报关单号 -->
      <template #customsDeclaration="{ record }">
        <div class="link" @click="openDetailModal(record, 'declaration')">{{ record.beiyong }}</div>
      </template>
      <!-- 点击舱单号 -->
      <template #manifestNum="{ record }">
        <div class="link" @click="openDetailModal(record, 'manifest')">{{ record.beiyong }}</div>
      </template>
      <!-- 点击查验记录单号 -->
      <template #recordNum="{ record }">
        <div class="link" @click="openDetailModal(record, 'record')">{{ record.beiyong }}</div>
      </template>
    </BasicTable>
    <!--表单抽屉-->
    <detailModal @register="registerModal" />
  </div>
</template>

<script lang="ts" name="system-user" setup>
  //ts语法
  import { BasicTable } from '/@/components/Table';
  import detailModal from './detailModal.vue';
  import { useModal } from '/@/components/Modal';
  import { useListPage } from '/@/hooks/system/useListPage';
  import { columns, searchFormSchema } from './dataCollection.data';
  import { useMessageHref } from '/@/views/system/message/components/useSysMessage';
  // import { getList } from './takeOrders.api';
  //注册drawer
  const [registerModal, { openModal: openDetail }] = useModal();
  // const [registerDeclarationModal, { openModal: openDetail2 }] = useModal();
  const { goPage } = useMessageHref();
  // 列表页面公共参数、方法
  const { tableContext } = useListPage({
    designScope: 'user-list',
    tableProps: {
      title: '',
      // api: getList,
      showActionColumn: false,
      dataSource: [
        {
          beiyong: '123456789',
        },
      ],
      columns: columns,
      size: 'small',
      formConfig: {
        // labelWidth: 200,
        schemas: searchFormSchema,
      },
      actionColumn: {
        width: 120,
      },
      beforeFetch: (params) => {
        return Object.assign({ column: 'createTime', order: 'desc' }, params);
      },
    },
  });

  //注册table数据
  const [registerTable, { reload }] = tableContext;

  /**
   * 打开详情
   */
  function openDetailModal(record, type) {
    // let anntId = record.anntId;
    // editCementSend({ anntId: anntId }).then((res) => {
    //   reload();
    //   syncNotic({ anntId: anntId });
    // });//获取数据
    const openModalFun = () => {
      openDetail(true, {
        record,
        type: type,
      });
    };
    goPage(record, openModalFun);
  }
</script>

<style scoped>
  .link {
    color: #1677ff;
  }
  .link:hover {
    text-decoration: underline;
    cursor: pointer;
  }
</style>
